package com.nbufe.controller;

import com.nbufe.domain.ResponseResult;
import com.nbufe.domain.entity.Material;
import com.nbufe.service.DataService;
import com.nbufe.service.MaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author LZH
 * @date 2023/4/2
 */
@CrossOrigin
@Api(tags = "材料模块接口")
@RestController
@RequestMapping("/material")
public class MaterialController {

    @Resource
    private MaterialService materialService;

    @Resource
    private DataService dataService;

    @ApiOperation("获取所有燃料燃烧阶段的材料")
    @GetMapping("/list")
    public ResponseResult listMaterial() {
        List<Material> materialList = materialService.listFossiFuel();
        return ResponseResult.okResult(materialList);
    }

    @ApiOperation("获取指定阶段的能源材料")
    @GetMapping("/queryEmissionOriginByStage")
    public ResponseResult queryEmissionOrigin(Integer stage) {
        return ResponseResult.okResult(dataService.queryTargetStageEmissionOrigin(stage));
    }

}
